import grails.converters.JSON
import org.gruposp2p.proyectokarma.domain.Peer;
import java.security.Security;

class BootStrap {

	def exceptionHandler
	def motorDeFirmasService
	
    def init = { servletContext ->
         JSON.registerObjectMarshaller(Date) {
            return it?.format("yyyy-MM-dd")
         }
		 Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
		 motorDeFirmasService.inicializar()
		 /*JSON.registerObjectMarshaller(Peer) {
			 def returnArray = [:]
			 returnArray['name'] = it.name
			 returnArray['addresses'] = it.peerAddresses.collect { peerAddress ->
				 return [id:peerAddress.address.id]
			 }
			 return returnArray
		 }*/

    }
    
    def destroy = { }
    
}
